package com.mjf.web.controller.common;

import com.mjf.ys.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * desc
 * </p>
 *
 * @author chenshoumeng
 * @date 2025/6/8 00:51
 */
@RestController
@RequestMapping("/ys/async")
public class YSAsyncController {

    @Autowired
    private YsProductService ysProductService;
    @Autowired
    private FsYsProductClassService fsYsProductClassService;
    @Autowired
    private FsYsUserInfoService fsYsUserInfoService;
    @Autowired
    private FsYsUserService fsYsUserService;
    @Autowired
    private FsYsSalesoutListService fsYsSalesoutListService;
    @Autowired
    private FsYsAllAuxiliaryBalanceQueryService fsYsAllAuxiliaryBalanceQueryService;

    /**
     * 同步商品信息
     */
    @GetMapping("/product")
    public Object asyncProduct() {
        ysProductService.asyncProduct();
        return "success";
    }

    /**
     * 同步商品分类
     */
    @GetMapping("/product/class")
    public Object asyncProductClass() {
        fsYsProductClassService.asyncProductClass();
        return "success";
    }

    /**
     * 同步租户员工信息
     */
    @GetMapping("/user")
    public Object asyncUser() {
        fsYsUserInfoService.asyncUser();
        return "success";
    }

    /**
     * 同步员工
     */
    @GetMapping("/person")
    public Object asyncPerson() {
        fsYsUserService.asyncPerson();
        return "success";
    }

    /**
     * 同步销售出库单
     */
    @GetMapping("/salesout")
    public Object asyncSalesout(
        @RequestParam(required = false) String start, @RequestParam(required = false) String end
    ) {
        fsYsSalesoutListService.asyncSalesout(start, end);
        return "success";
    }

    /**
     * 科目辅助全景查询
     */
    @GetMapping("/account")
    public Object asyncAccount(@RequestParam("startperiod") String startperiod) {
        fsYsAllAuxiliaryBalanceQueryService.asyncAccount(startperiod);
        return "success";
    }


}
